<?php

/**
 * Klasa z formatkami dla strony błędów
 *
 */
class Default_Form_Errors {
	/**
	 * Prosta formatka do zapisania informacji o błędzie
	 *
	 * @return Core_Form
	 */
	public function feedback() {
		$form = new Core_Form();
		$form->setMethod(Core_Form::METHOD_POST)
			->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'default', 'controller' => 'error', 'action' => 'error'), 'default', true))
			->setAttrib('enctype', 'multipart/form-data')
			->setName(__FUNCTION__ . 'Form');
			
		$form->addElements(array(
			$form->createElement('text', 'mail')
				->setLabel('Adres email')
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('maxlength', 64)
				->addValidator('StringLength', true, array(6, 64))
				->addValidator('EmailAddress', true),
			$form->createElement('textarea', 'content')
				->setLabel('Opis błędu')
				->setRequired(true),
			$form->createElement('submit', 'submit')
				->setLabel('Wyślij')
		));
		
		return $form;
	}
}